projects
/
project
/
bcm63xx
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e22cc0c
)
net, phy, cpsw: fix NULL pointer deference
author
Heiko Schocher
<
[email protected]
>
Thu, 5 Sep 2013 09:50:41 +0000
(11:50 +0200)
committer
Tom Rini
<
[email protected]
>
Fri, 20 Sep 2013 20:57:40 +0000
(16:57 -0400)
if phy_connect() did not find a phy, phydev is NULL and
following code in cpsw_phy_init() crashes. Fix this.
Signed-off-by: Heiko Schocher <
[email protected]
>
Cc: Joe Hershberger <
[email protected]
>
Cc: Mugunthan V N <
[email protected]
>
Cc: Tom Rini <
[email protected]
>
Acked-by: Mugunthan V N <
[email protected]
>
drivers/net/cpsw.c
patch
|
blob
|
history
diff --git
a/drivers/net/cpsw.c
b/drivers/net/cpsw.c
index 9bab71a212d94e08f7c010573819773e1afbd30b..39240d9662143e2c33a1e90f6309e9ab83e61666 100644
(file)
--- a/
drivers/net/cpsw.c
+++ b/
drivers/net/cpsw.c
@@
-568,9
+568,14
@@
static void cpsw_set_slave_mac(struct cpsw_slave *slave,
static void cpsw_slave_update_link(struct cpsw_slave *slave,
struct cpsw_priv *priv, int *link)
{
- struct phy_device *phy
= priv->phydev
;
+ struct phy_device *phy;
u32 mac_control = 0;
+ phy = priv->phydev;
+
+ if (!phy)
+ return;
+
phy_startup(phy);
*link = phy->link;
@@
-947,6
+952,9
@@
static int cpsw_phy_init(struct eth_device *dev, struct cpsw_slave *slave)
dev,
slave->data->phy_if);
+ if (!phydev)
+ return -1;
+
phydev->supported &= supported;
phydev->advertising = phydev->supported;